//
//  YGScienceCenterLowerViewController.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/26.
//

#import "YGScienceCenterLowerViewController.h"
#import "YGScienceLowerHeaderView.h"
#import "YGScienceLowerTableViewCell.h"

@interface YGScienceCenterLowerViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) YGScienceLowerHeaderView *headerView;
@property (nonatomic, strong) UITableView *contentTableView;



@end

@implementation YGScienceCenterLowerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置导航栏属性
    //self.navigationController.navigationBar.barTintColor = UIColorFromRGB(0x37C8D7);
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : UIColorFromRGB(0x333333)}];
    
    [self initView];
    [self initconstraints];
    // Do any additional setup after loading the view.
}

-(void)initView{
    
    [self.view addSubview:self.headerView];
    [self.view addSubview:self.contentTableView];
}

-(void)initconstraints{
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.view.mas_top).offset(63.5);
            make.left.right.mas_equalTo(self.view);
            make.height.mas_equalTo(200.5);
    }];
    
    [self.contentTableView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.headerView.mas_bottom).offset(5);
            make.left.mas_equalTo(self.view.mas_left);
            make.right.mas_equalTo(self.view.mas_right);
            make.height.mas_equalTo(self.view.mas_height);
    }];
}

//二级页面设置标题
-(void)setTitle:(NSString *)title{
    [self setTitle:title];
}

#pragma setter

- (UIView *)headerView{
    if (!_headerView) {
        _headerView = [[YGScienceLowerHeaderView alloc]init];
    }
    return _headerView;
}

//- (UITableView *)contentTableView{
//    if (!_contentTableView) {
//        _contentTableView = [UITableView alloc]initWithFrame:<#(CGRect)#> style:<#(UITableViewStyle)#>
//    }
//}
- (UITableView *)contentTableView{
    if (!_contentTableView) {
        _contentTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        _contentTableView.delegate = self;
        _contentTableView.dataSource = self;
        [_contentTableView registerClass:YGScienceLowerTableViewCell.class forCellReuseIdentifier:@"YGScienceLowerTableViewCell"];
    }
    return _contentTableView;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
